#include "NeuronLayer.h"

namespace fullsail_ai {

	void NeuronLayer::initialize(std::size_t argumentCount, std::size_t activationValueCount,
	                             int (*numberGenerator)())
	{
		// TODO: 3
		// Create and initialize the neurons in this layer.
		neurons.resize(activationValueCount);
		for(unsigned i = 0; i < activationValueCount;i++)
		{
			Neuron tNeuron;
			tNeuron.initialize(argumentCount,numberGenerator);
			neurons[i] = tNeuron;
		}
	}

	void NeuronLayer::feedForward(std::vector<double> const& arguments,
	                              std::vector<double>& activationValues) const
	{
		// TODO: 7
		// Compute the activation values of each neuron.
		activationValues.resize(getNeurons().size());
		for(unsigned i = 0; i < getNeurons().size();i++)
		{
			activationValues[i] = getNeurons()[i].computeActivationValue(arguments);
		}
	}

	void NeuronLayer::backPropagate(std::vector<double> const& arguments,
	                                std::vector<double> const& valueErrors, double learningFactor)
	{
		// TODO: 12
		// Adjust each neuron's weights and biases.
	}
}  // namespace fullsail_ai

